﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace WpfPdfReader
{
    public class FileItemViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        private FileItemModel fileItemModel = new FileItemModel();
        public FileItemViewModel(FileItemModel model)
        {
            this.fileItemModel = model;
        }
        public FileItemViewModel() { }

        public FileItemModel FileItem
        {
            get { return this.fileItemModel; }
        }

        public string Name
        {
            get { return this.fileItemModel.Name; }
            set
            {
                this.fileItemModel.Name = value;
                RaisePropertyChanged("Name");
            }
        }

        public string FullName
        {
            get { return this.fileItemModel.FullName; }
            set
            {
                this.fileItemModel.FullName = value;
                RaisePropertyChanged("FullName");
            }
        }

        public DateTime Time
        {
            get { return this.fileItemModel.Time; }
            set
            {
                this.fileItemModel.Time = value;
                RaisePropertyChanged("Time");
            }
        }

        public int Page
        {
            get { return this.fileItemModel.Page; }
            set
            {
                this.fileItemModel.Page = value;
                RaisePropertyChanged("Page");
            }
        }

        public string LastPageBmpPath
        {
            get { return this.fileItemModel.LastPageBmpPath; }
            set
            {
                this.fileItemModel.LastPageBmpPath = value;
                RaisePropertyChanged("LastPageBmpPath");
            }
        }

        public string TitlePageBmpPath
        {
            get { return this.fileItemModel.TitlePageBmpPath; }
            set
            {
                this.fileItemModel.TitlePageBmpPath = value;
                RaisePropertyChanged("TitlePageBmpPath");
            }
        }

        public List<BookMark> BookMarks
        {
            get { return this.fileItemModel.BookMarks; }
            set
            {
                this.fileItemModel.BookMarks = value;
                RaisePropertyChanged("BookMarks");
            }
        }

        public override string ToString()
        {
            return this.FileItem.ToString();
        }
    }

}
